package org.light.layouts;

import org.light.core.PrismInterface;
import org.light.domain.Domain;
import org.light.easyuilayouts.EasyUIGridPageLayout;
import org.light.easyuilayouts.OracleEasyUIGridPageLayout;
import org.light.easyuilayouts.widgets.Nav;
import org.light.utils.WriteableUtil;

public class OracleEasyUIGridPagePI extends EasyUIGridPagePI{
	protected OracleEasyUIGridPageLayout eLayout;

	public OracleEasyUIGridPagePI(Domain domain) throws Exception{
		super(domain);
		this.eLayout = new OracleEasyUIGridPageLayout(domain);
		this.eLayout.parse();
		this.frame.setStandardName(domain.getText());
		this.getFrame().setMainContent(this.eLayout);
	}	

	@Override
	public boolean validateVerbs() throws Exception {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setTitles(String title, String subTitle,String footer) {
		this.getFrame().setTitles(title, subTitle, footer);
	}

	@Override
	public void generatePIFiles(String targetFolderPath) throws Exception {
		String relativeFolder = "WebContent/pages/";
		String relativeFolder0 = "src/main/resources/static/pages/";
		if ("smeu".equalsIgnoreCase(this.technicalStack)||"msmeu".equalsIgnoreCase(this.technicalStack)) {
			WriteableUtil.writeToFile(targetFolderPath + "/"+relativeFolder+this.domain.getPlural().toLowerCase()+".html", this.getFrame().generateFrameSetStatementList().getContent());
		}else {
			WriteableUtil.writeToFile(targetFolderPath + "/"+relativeFolder0+this.domain.getPlural().toLowerCase()+".html", this.getFrame().generateFrameSetStatementList().getContent());
		}
	}

	@Override
	public void generatePIFromDomian() throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean validateDomain() throws Exception {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean validateLayout() throws Exception {
		// TODO Auto-generated method stub
		return false;
	}
	
	@Override
	public void setNav(Nav nav) {
		this.getFrame().setNav(nav);
	}

	public OracleEasyUIGridPageLayout geteLayout() {
		return eLayout;
	}

	public void seteLayout(OracleEasyUIGridPageLayout eLayout) {
		this.eLayout = eLayout;
	}
}
